package com.lane.core.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.lane.core.service.BaseManager;

/**
 * 控制器基类
 * @author 黄连忠
 */
public abstract class BaseController implements SessionAware, ServletRequestAware, ServletResponseAware {
	protected HttpServletRequest request; 
	protected HttpServletResponse response; 
	protected BaseManager baseManager;
	
    public void setServletRequest(HttpServletRequest request) { 
        this.request = request; 
    }

    public void setServletResponse(HttpServletResponse response) { 
        this.response = response; 
    }

	public void setSession(Map<String, Object> arg0) {
		// TODO 暂时不需要写代码
		
	}
	
	/**
	 * 打印消息
	 */
	protected void printMessage(String msg){
		try {
			PrintWriter out = response.getWriter();
			out.print(msg);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public BaseManager getBaseManager() {
		return baseManager;
	}

	public void setBaseManager(BaseManager baseManager) {
		this.baseManager = baseManager;
	}
}
